<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateScoreRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('score_records', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id',false,true)->default(0)->comment('用户id');
            $table->tinyInteger('type')->default(1)->comment('类型，1足彩推荐,2,3其他,');
            $table->float('pre_score',10,2)->default(0)->comment('修改之前的积分');
            $table->float('score',8,2)->default(0)->comment('修改的积分');
            $table->string('remark',255)->default('')->comment('备注');
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->index('user_id');
        });
	    \Illuminate\Support\Facades\DB::statement("ALTER TABLE `score_records` comment '积分变动记录'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('score_records');
    }
}
